#!/usr/bin/python
# -*- coding:utf-8 -*-
__author__ = 'leiyuany'
import smtplib
from email.mime.text import MIMEText
from email.header import Header
from email.mime.multipart import MIMEMultipart

#def send_mail:
email_host = "mail.servyou.com.cn"
email_user = "leiyuany"
email_pass = "servyou2015"
email_port = 25


sender = "leiyuany@servyou,com.cn"
receivers = ['287721220@qq.com','1196501911@qq.com']

message = MIMEMultipart()
body = MIMEText('PYTHON测试发送。。。','plain','utf-8')
message['From'] = Header("菜鸟教程",'utf-8')
message['To'] = Header('测试','utf-8')

subject = "python smtp 邮件测试"
message['Subject'] = Header(subject,'utf-8')
message.attach(body)

try:
    smtpObj = smtplib.SMTP()
    smtpObj.connect(email_host,email_port)
    smtpObj.login(email_user,email_pass)
    smtpObj.sendmail(sender,receivers,message.as_string())
    print "发送邮件!!!"
except smtplib.SMTPException:
    print "ERROR,发送失败，请排查问题！"